package com.example.springboot2logger.service;

import com.example.springboot2logger.controller.Usercontroller;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@Slf4j // 替代了之前需要通过 LoggerFactory.getLogger() 的操作
@ResponseBody  //返回一个非静态页面的数据
public class UserService {
//    //1.先得到日志对象(slf4)
//    private final static Logger log = LoggerFactory.getLogger(UserService.class);// 设置当前类的类型
    @RequestMapping("/sayhi2")
    public void sayhi2(){
        log.trace("我是 trace");
        log.debug("我是 debug");
        log.info("我是 info");
        log.warn("我是 warn");
        log.error("我是 error");
    }
}
